#pragma once

#include <windows.h>

#include "tinyxml.h"

class XmlNode : private TiXmlNode
{
public:
	const char * GetTagName();
	XmlNode *	GetParent();

	int			GetChildNodeCount( const char * tagName );
	XmlNode *	GetChildNode( const char * tagName, int idx = 0 );

	XmlNode *	AddChildNode( const char * tagName );
	BOOL		DelChildNode( const char * tagName, int idx = 0  );

	const char * GetAttribute( const char * name );
	void		SetAttribute( const char * name, const char * value );

	const char * GetText();
	void		SetText( const char * text );
};

/////////////////////////////////////////////////////////////////////////////////////////////

class XmlDocument : private TiXmlDocument
{
public:
	bool LoadFile( const char * fileName );
	bool SaveFile( const char * fileName );

	XmlNode * GetRootNode();

	XmlNode *	GetChildNode( const char * tagName, int idx = 0 );
	XmlNode *	AddChildNode( const char * tagName );
};
